
class CircularShift:
    def __init__(self, raw_data, split_word_list=[], circular_shift_list=[]):
        self.raw_data = raw_data
        self.split_word_list = split_word_list
        self.circular_shift_list = circular_shift_list

    # 单词分割
    def __split_word(self):
        for i in range(len(self.raw_data)):
            self.split_word_list.append([])
            for word in self.raw_data[i].split(" "):
                self.split_word_list[i].append(word)
        return self.split_word_list

    # 单词移位
    def __circular_shift(self):
        sentence = ""
        k = 0
        for word in self.split_word_list:
            self.circular_shift_list.append([])
            for i in range(len(word)):
                word.append(word.pop(0))
                for one in word:
                    sentence = sentence + one + " "
                self.circular_shift_list[k].append(sentence[:-1])
                sentence = ""
            k = k + 1

    def run(self):
        self.__split_word()
        self.__circular_shift()
        return self.circular_shift_list
